//
//  CourseWork.m
//  Gradekeeper0.2
//
//  Created by Qian Tim on 09-11-17.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "CourseWork.h"

@implementation CourseWork

@synthesize name, mark, maxMark, type, startDate, dueDate, percentage;

-(CourseWork*) initWithName:(NSString*)newName Type:(NSString*)newType Mark:(float)newMark MaxMark:(float)newMaxMark StartDate:(NSString*)newStartDate DueDate:(NSString*)newDueDate {
	self = [super init];
    if ( self ) {
       	self.name = newName;
		self.type = newType;
		self.startDate = newStartDate;
		self.dueDate = newDueDate;
		self.mark = newMark;
		self.maxMark = newMaxMark;
		[self setPercentage];
    }
    return self;
}

-(void) setMark: (float) newMark {
	self.mark = newMark;
	[self setPercentage];
}

-(void) setPercentage {
	percentage=(self.mark/self.maxMark*100);
}


@end
